// pf_lib.cpp : ���Ӧ����ڵ㡣
//

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <include/pf_crc.h>




int main()
{
    uint16_t crc16 =0;
    uint16_t crc16_1 =0;
    uint32_t crc32 =0;
    char   test_string[] = "hello world";
    char   test_string1[] = "hello";
    char   test_string2[] = " world";
	pf_crc16_t * p_crc16   = NULL;
	pf_crc16_t * p_crc16_1   = NULL;
	pf_crc32_t * p_crc32   = NULL;
	
	p_crc16 = pf_crc16_start();
	p_crc16_1 = pf_crc16_start();
    p_crc32 = pf_crc32_start();
    
	pf_crc16_append(p_crc16,(const void*) test_string,strlen(test_string));
	//pf_crc32_append(p_crc32,(const void*) test_string,strlen(test_string));
	
    pf_crc16_append(p_crc16_1,(const void*) test_string1,strlen(test_string1));
	pf_crc16_append(p_crc16_1,(const void*) test_string2,strlen(test_string2));
	
	crc16 = pf_crc16_finish(p_crc16);
	crc16_1 = pf_crc16_finish(p_crc16_1);
	crc32 = pf_crc32_finish(p_crc32);
	
    printf("crc16:%x\n,crc16 append:%x\n",crc16,crc16_1);
	printf("crc32:%x\n",crc32);
	return 0;
}

